#ifndef LOCATION_H_
#define LOCATION_H_

#include <iostream>

using namespace std;

class Location{
public:

	Location(int y_loc,int x_loc):
		y(y_loc),x(x_loc),directionfaced(north),
		prev_y(y_loc),prev_x(x_loc),prev_directionfaced(north){};

	enum Direction {north, east, south, west};

	void printlocation()
	{
		cout << y << "," << x;
	};

	void printdirection()
	{
		if (directionfaced == north)
		{
			cout << "north";
		}
		else if (directionfaced == east)
		{
			cout << "east";
		}
		else if (directionfaced == south)
		{
			cout << "south";
		}
		else if (directionfaced == west)
		{
			cout << "west";
		}
	};

	int getYlocation(){
		return y;
	};
	int getXlocation(){
		return x;
	};

	Direction getdirection(){
		return directionfaced;
	};

	void setX(int newX){
		prev_x = x;
		x = newX;
	}
	void setY(int newY){
		prev_y = y;
		y = newY;
	}
	void setDirection(Direction newDir){
		prev_directionfaced = directionfaced;
		directionfaced = newDir;
	}

	int getPrevYlocation(){
		return prev_y;
	};
	int getPrevXlocation(){
		return prev_x;
	};

	int getPrevdirection(){
		return prev_directionfaced;
	};


	void moveY(int dis){
		setY(y+dis);
	};
	void moveX(int dis){
		setX(x+dis);
	};
protected:
	int x;
	int y;
	Direction directionfaced;

	int prev_x;
	int prev_y;
	Direction prev_directionfaced;
};


#endif /* LOCATION_H_ */
